package com.linq.cool.auth.dto;

import com.linq.cool.api.domain.BeautyMember;
import com.linq.cool.common.constants.UserConstants;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * @Author: yqlin
 * @Date: 2021/1/31 01:39
 * @Description:
 * @Version: 1.0.0
 */
@Data
@Accessors(chain = true)
public class WeChatRegisterDTO implements Serializable {

    /**
     * 头像
     */
    private String avatarUrl;

    /**
     * 省份
     */
    private String province;

    /**
     * 城市
     */
    private String city;

    /**
     * 国家
     */
    private String country;

    /**
     * 性别
     */
    private Integer gender;

    /**
     * 昵称
     */
    private String nickName;

    /**
     * openId
     */
    private String openId;


    public BeautyMember toBeautyMember() {
        BeautyMember member = new BeautyMember()
                .setAvatar(avatarUrl)
                .setNickname(nickName)
                .setOpenId(openId);
        if (gender == 1) {
            member.setGender(UserConstants.StateEnum.USER_GENDER_MALE.getCode());
        }
        if (gender == 2) {
            member.setGender(UserConstants.StateEnum.USER_GENDER_FEMALE.getCode());
        }
        if (gender == 0) {
            member.setGender(UserConstants.StateEnum.USER_GENDER_UNLIMITED.getCode());
        }
        return member;
    }
}
